import subprocess
import sys

def run_script(script_name, keyword):
    result = subprocess.run([sys.executable, script_name, keyword], capture_output=True, text=True)
    if result.returncode == 0:
        print(f"{script_name} executed successfully.")
        print(result.stdout)
    else:
        print(f"Error occurred while executing {script_name}.")
        print(result.stderr)

def main():
    keyword = '装修'  # 你想要传递的关键字

    # 运行第一个脚本，获取数据并保存到关键字目录中
    run_script('get_note_by_keyword.py', keyword)

    # 运行第二个脚本，处理刚才保存的数据
    run_script('extract_ids_from_file.py', keyword)

if __name__ == '__main__':
    main()
